package com.jh.web.sys;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jh.pojo.IPCamRadarInfo;
import com.jh.service.impl.IPCamRadarInfoSrvImpl;

/**
 * Servlet implementation class DelDeviceServlet
 */
@WebServlet("/DelDeviceServlet")
public class DelDeviceServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public DelDeviceServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset:utf-8");
        String devId = request.getParameter("devId");
        IPCamRadarInfo iri = new IPCamRadarInfo();
        iri.setSp_id(Integer.parseInt(devId));
        /*判断是否存在*/
        IPCamRadarInfoSrvImpl srv = new IPCamRadarInfoSrvImpl();
        boolean rst = srv.delete(iri);
        response.getWriter().print(rst); // 给ajax返回值

    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}
